package com.mnt.gui.base.util;

import java.util.ResourceBundle;

/**
 * i18n tools
 * get key by _zh or _us properties value
 * @author 2014-6-12 mnt.cico
 */
public class I18nHelper
{
	
	private static final ResourceBundle resource = ResourceBundle.getBundle("");
	
	private I18nHelper() {
		//empty
	}
	
	/**
	 * get value by key  if not contains return null
	 * 2014-6-12 mnt.cico
	 * @param key is properties key
	 * @return
	 */
	public static final String getValueByKey(String key) {
		return getValueByKey(key, null);
	}
	
	/**
	 * get value by key  if not contains return defaultValue
	 * 2014-6-12 mnt.cico
	 * @param key
	 * @param defaultValue is if not contains return defaultValue
	 * @return
	 */
	public static final String getValueByKey(String key, String defaultValue) {
		if(resource.containsKey(key)) {
			return resource.getString(key);
		}
		return defaultValue;
	}
	
	
}
